<!--编辑/添加销量-->
<div class="dialog_content">
	<form id="info_form" action="{:U('version/oppt')}" method="post">
    <input type="hidden" name="opttype" value="{$opptType}" />
   
	<table width="100%" class="table_form">
 	    <tr>
			<th>版本名称 :</th>
			<td>
		         <input type="text" class="input-text" name="name" value="{$info.name}" />
			</td>
		</tr> 
        
 	    <tr>
			<th>下载地址 :</th>
			<td>
  	            <input type="text" name="downLoad" id="J_apk" class="input-text fl mr10" size="30" value="{$info.downLoad}">
            	<div id="J_upload_apk" class="upload_btn"><span>{:L('upload')}</span></div>
			</td>
		</tr>  
              
 	    <tr>
			<th>版本号 :</th>
			<td>
		         <input type="text" class="input-text" name="version" value="{$info.version}" />
			</td>
		</tr>   	    
        
	</table>
	<input type="hidden" name="id" value="{$info.id}" />
	</form>
</div>
<script src="__STATIC__/js/fileuploader.js"></script>
<script>
$(function(){
	$.formValidator.initConfig({formid:"info_form",autotip:true});
	
	$('#info_form').ajaxForm({success:complate,dataType:'json'});
	function complate(result){
		if(result.status == 1){
			$.dialog.get(result.dialog).close();
            $.pinphp.tip({content:result.msg});
            window.location.reload();
		} else {
			$.pinphp.tip({content:result.msg, icon:'alert'});
		}
	}
    
	//上传apk
    var uploader = new qq.FileUploaderBasic({
    	allowedExtensions: ['apk','rar','zip'],
        button: document.getElementById('J_upload_apk'),
        multiple: false,
        action: "{:U('version/ajax_upload_apk')}",
        inputName: 'apk',
        forceMultipart: true, //用$_FILES
        messages: {
        	typeError: lang.upload_type_error,
        	sizeError: lang.upload_size_error,
        	minSizeError: lang.upload_minsize_error,
        	emptyError: lang.upload_empty_error,
        	noFilesError: lang.upload_nofile_error,
        	onLeave: lang.upload_onLeave
        },
        showMessage: function(message){
        	$.pinphp.tip({content:message, icon:'error'});
        },
        onSubmit: function(id, fileName){
        	$('#J_upload_apk').addClass('btn_disabled').find('span').text(lang.uploading);
        },
        onComplete: function(id, fileName, result){
        	$('#J_upload_apk').removeClass('btn_disabled').find('span').text(lang.upload);
            if(result.status == '1'){
        		$('#J_apk').val(result.data);
        	} else {
        		$.pinphp.tip({content:result.msg, icon:'error'});
        	}
        }
    });
});

</script>